package cn.jeeweb.web.modules.sys.service.impl;

import cn.jeeweb.common.mybatis.mvc.service.impl.CommonServiceImpl;
import cn.jeeweb.common.mybatis.mvc.wrapper.EntityWrapper;
import cn.jeeweb.common.query.data.PropertyPreFilterable;
import cn.jeeweb.common.query.data.Queryable;
import cn.jeeweb.common.query.utils.QueryableConvertUtils;
import cn.jeeweb.common.utils.StringUtils;
import cn.jeeweb.web.modules.sys.entity.Role;
import cn.jeeweb.web.modules.sys.mapper.RoleMapper;
import cn.jeeweb.web.modules.sys.service.IRoleService;

import java.util.List;

import cn.jeeweb.web.utils.PageRequest;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.baomidou.mybatisplus.plugins.Page;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service("roleService")
public class RoleServiceImpl extends CommonServiceImpl<RoleMapper, Role> implements IRoleService {

	@Override
	public List<Role> findListByUserId(String userid) {
		return baseMapper.findRoleByUserId(userid);
	}

	@Override
	public Page getListPage(Role role) {
		EntityWrapper<Role> entityWrapper = new EntityWrapper<>(Role.class);
		if (!StringUtils.isEmpty(role.getCode())) {
			entityWrapper.like("code", role.getCode());
		}
		if (!StringUtils.isEmpty(role.getName())) {
			entityWrapper.like("name", role.getName());
		}
		Page pageBean = selectPage(PageRequest.getPage(), entityWrapper);
		return pageBean;
	}

	@Override
	public List<Role> getRoleList(Role role) {
		return null;
	}

}
